package com.kcst.configure;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import java.util.Map;

/**
 * @author: glc.
 * Date: 2022/8/12  15:00
 * Description:
 * 参数配置界面
 */
public class ConfigureActivity extends AppCompatActivity {


    private ConfigureSettingView mConfigureSettingView;

    public static void startConfigureActivity(Context context){
        Intent intent = new Intent(context,ConfigureActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_configure);
        mConfigureSettingView = findViewById(R.id.view_config_value);
        findViewById(R.id.btn_save).setOnClickListener(v -> {
            mConfigureSettingView.saveValue();
        });

        getConfigureValue();
    }

    private void getConfigureValue(){
        Map<String, String> configureValues = ConfigureManager.getInstance().getConfigureValues();
        if (configureValues != null && configureValues.size() > 0){
            mConfigureSettingView.initView(configureValues);
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
    }
}
